#include<bits/stdc++.h>
using namespace std;
const int N=1e5 + 5;
inline int read(){
    int x=0,y=1;char c=getchar();
    while(!isdigit(c)){if(c=='-')y=-1;c=getchar();}
    while(isdigit(c)){x=x*10+c-48;c=getchar();}
    return x*y;
}

int n,r[N],cnt[N],last,to[N],nxt[N],ans,cur;
int main(){
    freopen("duel.in","r",stdin);
    freopen("duel.out","w",stdout);
    cin>>n;
    for(int i=1;i<=n;++i){
        cin>>r[i];
        cnt[r[i]]++;
    }
    for(int i=1;i<=100000;++i){
        if(cnt[i]){
            //cout<<cur<<" "<<cnt[i]<<endl;
            if(cnt[i]>=cur){
                ans+=cur;
                cur=cnt[i];
            }else{
                ans+=cnt[i];
            }
        }
    }
    cout<<n-ans<<endl;
    return 0;
}
/*
5
1 2 3 1 2
10
136 136 136 2417 136 136 2417 136 136 136
*/